#ifndef PLACE_LIST_VIEW_H
#define PLACE_LIST_VIEW_H

#include <QDialog>

#include "view_base.h"
#include "result_processor.h"
#include "data_types.h"

namespace Ui {
    class PlaceListView;
}

class QListWidgetItem;
class PlaceView;

class PlaceListView : public ViewBase, ResultProcessor
{
    Q_OBJECT

public:
    explicit PlaceListView(QWidget *parent = 0);
    virtual ~PlaceListView();

    virtual void IssueRequest();

    inline void SetCategoryAndSubCate(cate category, cate subCategory) {
      category_ = category;
      subCategory_ = subCategory;
    }

public slots:
    void showPlace(QListWidgetItem *item);

  protected:
    virtual int ProcessResult(RequestMethod &r, QDomElement &e);

  private:
    int parse_result(QDomElement &e);
    int parse_places(QDomElement &e);

private:
    Ui::PlaceListView *ui;
    cate category_;
    cate subCategory_;

    QVector<place> places_;

    PlaceView *placeView_;
};

#endif // PLACE_LIST_VIEW_H
